class Transcation {
  perform(anyMethod,warppers){
    warppers.forEach(wrapper => {
      wrapper.initialize();
    });
    anyMethod();
    warppers.forEach(wrapper => {
      wrapper.close();
    });
  }
}
let transcation = new Transcation();

let oldFunc = ()=>{
  console.log('原有逻辑')
}
// transaction.perform(oldFunc,{
//   initialize(){
//     console.log('初始化')
//   },
//   close(){
//     console.log('关闭');
//   }
// });
transcation.perform(oldFunc,[{
  initialize(){
    console.log('初始化1')
  },
  close(){
    console.log('关闭1');
  }
},{
  initialize(){
    console.log('初始化2')
  },
  close(){
    console.log('关闭2');
  }
}]);